<?php

require_once('inc.config.php');

$hid = $_GET["id"];
$plaza= $_GET["pp"];
$lx = $_GET["lx"];

if(!isset($hid)||!isset($plaza)){
	header("Location:index.php");
	exit;
}

$useTemplate   = 'compare.html';

$page = new QuickSkin ($useTemplate );

template_ini($page);

$page->assign("indexcls" , "bfont");

$info = $myHouse->getShouseInfo($hid);
$goldlist = $myAgent->getGoldenList();

$condition = array(
	"plaza" => $plaza,
	"lx"=>$lx,
	"id" => $hid."~"
);
$result = $myHouse->getSearchSellList($condition , 1 , -1);

$sum = 0;
for($i=0, $l=count($result) ; $i< $l; $i++){
	$result[$i]["perprice"] = round($result[$i]["price"]/$result[$i]["square"] , 2);
	$sum += floatval($result[$i]["perprice"]);
}
if(count($result)==0){
	$per = 0;
}else{
	$per = round($sum/count($result) , 2);
}

$page->assign($info);
$page->assign("goldlist" , $goldlist);

$page->assign("selllist" , $result);

$page->assign("total" , count($result));
$page->assign("per" , $per);

$page->assign("indexcls" , "nv_current");

$page->output();


ob_end_flush();

?>